package com.tianyang.yukuaifu.business.trade.provider;

import android.content.Context;
import android.content.Intent;

import com.tianyang.yukuaifu.business.trade.bean.SettleBankOutput;
import com.tianyang.yukuaifu.business.trade.bean.TradeRecordOutput;
import com.tianyang.yukuaifu.business.trade.contract.TradeConfig;
import com.tianyang.yukuaifu.business.trade.view.AchievementActivity;
import com.tianyang.yukuaifu.business.trade.view.BankManageActivity;
import com.tianyang.yukuaifu.business.trade.view.EarningsActivity;
import com.tianyang.yukuaifu.business.trade.view.MerchantAchieveActivity;
import com.tianyang.yukuaifu.business.trade.view.SettleMethodActivity;
import com.tianyang.yukuaifu.business.trade.view.SubAgentStatActivity;
import com.tianyang.yukuaifu.business.trade.view.SubMerchantStatActivity;
import com.tianyang.yukuaifu.business.trade.view.TradeDetailActivity;
import com.tianyang.yukuaifu.business.trade.view.TradeRecordActivity;
import com.tianyang.yukuaifu.business.trade.view.UpdateSettleCardActivity;
import com.tianyang.yukuaifu.business.trade.view.WithdrawActivity;
import com.tianyang.yukuaifu.business.trade.view.WithdrawRecordActivity;
import com.tianyang.yukuaifu.utils.IntentTool;

/**
 * Description：trade模块内部跳转类
 * Created by 薛勇军 on 2024/1/9.
 */
public class TradeOpenProvider {

    private static TradeOpenProvider instance;

    public static TradeOpenProvider getInstance() {
        if (instance == null) {
            synchronized (TradeOpenProvider.class) {
                if (instance == null) {
                    instance = new TradeOpenProvider();
                }
            }
        }
        return instance;
    }

    /**
     * 银行卡管理
     */
    public void openBankManageActivity(Context context, boolean isAgent) {
        Intent intent = new Intent(context, BankManageActivity.class);
        intent.putExtra(TradeConfig.INTENT_IS_AGENT, isAgent);
        IntentTool.startActivity(context, intent);
    }

    /**
     * 收益
     */
    public void openEarningsActivity(Context context) {
        IntentTool.startActivity(context, EarningsActivity.class);
    }

    /**
     * 提现
     */
    public void openWithdrawActivity(Context context) {
        IntentTool.startActivity(context, WithdrawActivity.class);
    }

    /**
     * 提现记录
     */
    public void openWithdrawRecordActivity(Context context) {
        IntentTool.startActivity(context, WithdrawRecordActivity.class);
    }

    /**
     * 修改结算卡
     */
    public void openUpdateSettleCardActivity(Context context, SettleBankOutput output, boolean isAgent, int requestCode) {
        Intent intent = new Intent(context, UpdateSettleCardActivity.class);
        intent.putExtra(TradeConfig.INTENT_SETTLE_BANK, output);
        intent.putExtra(TradeConfig.INTENT_IS_AGENT, isAgent);
        IntentTool.startActivityForResult(context, intent, requestCode);
    }

    /**
     * 交易记录
     */
    public void openTradeRecordActivity(Context context) {
        IntentTool.startActivity(context, TradeRecordActivity.class);
    }

    /**
     * 结算方式
     */
    public void openSettleMethodActivity(Context context) {
        IntentTool.startActivity(context, SettleMethodActivity.class);
    }

    /**
     * 交易详情
     */
    public void openTradeDetailActivity(Context context, TradeRecordOutput output, String title) {
        Intent intent = new Intent(context, TradeDetailActivity.class);
        intent.putExtra(TradeConfig.INTENT_TRADE_OUTPUT, output);
        intent.putExtra(TradeConfig.INTENT_TITLE, title);
        IntentTool.startActivity(context, intent);
    }

    /**
     * 业绩
     */
    public void openAchievementActivity(Context context) {
        IntentTool.startActivity(context, AchievementActivity.class);
    }

    /**
     * 商户业绩
     */
    public void openMerchantAchieveActivity(Context context, boolean isSubMerchant) {
        Intent intent = new Intent(context, MerchantAchieveActivity.class);
        intent.putExtra(TradeConfig.INTENT_IS_SUB_MERCHANT, isSubMerchant);
        IntentTool.startActivity(context, intent);
    }

    /**
     * 间推业绩详情
     */
    public void openSubAgentStatActivity(Context context, String agentName, String agentPhone,
                                         String startTime, String endTime, boolean isMonthFilter) {
        Intent intent = new Intent(context, SubAgentStatActivity.class);
        intent.putExtra(TradeConfig.INTENT_AGENT_NAME, agentName);
        intent.putExtra(TradeConfig.INTENT_AGENT_PHONE, agentPhone);
        intent.putExtra(TradeConfig.INTENT_START_TIME, startTime);
        intent.putExtra(TradeConfig.INTENT_END_TIME, endTime);
        intent.putExtra(TradeConfig.INTENT_IS_MONTH_FILTER, isMonthFilter);
        IntentTool.startActivity(context, intent);
    }

    /**
     * 我的商户业绩详情
     */
    public void openSubMerchantStatActivity(Context context, String mchName, String mchPhone,
                                         String startTime, String endTime, boolean isMonthFilter) {
        Intent intent = new Intent(context, SubMerchantStatActivity.class);
        intent.putExtra(TradeConfig.INTENT_MCH_NAME, mchName);
        intent.putExtra(TradeConfig.INTENT_MCH_PHONE, mchPhone);
        intent.putExtra(TradeConfig.INTENT_START_TIME, startTime);
        intent.putExtra(TradeConfig.INTENT_END_TIME, endTime);
        intent.putExtra(TradeConfig.INTENT_IS_MONTH_FILTER, isMonthFilter);
        IntentTool.startActivity(context, intent);
    }
}
